package Node;

class Node
{
	private int data;
	private Node next;
	static Node first=null;
	
	Node(int value){data=value;next= first;first = this;}
	
	Node(Node d, int value){data=value;next = d;}
	
	Node getNode(){return next;}
	
	int getData(){return data;}
	
	void setData(int value){data=value;}
	
	void setNext(Node pNext){next=pNext;}
	
	static void tranverse()
	{
		for(Node p = first; p != null; p = p.next)
			System.out.print(p.data + "  ");
		
		System.out.print("\n");
	}
	
	static boolean FindData(int v)
	{
		for(Node p = first; p != null; p = p.next)
			if(p.data == v)
				return true;
		
		return false;
	}
	
	int Length()
	{
		int m = 0;
		for(Node p = first; p != null; p = p.next)
			m++;
			
		return m;
	}

	void  Insert(Node p,int e)
	{
		Node s = new Node(p.next,e);
		p.next = s;
	}
	
	public static void main(String []args)
	{
		new Node(1);
		new Node(2);
		new Node(3);
		new Node(4);
		new Node(5);
		
		Node.tranverse();
		
		if(FindData(-3))
		    System.out.println("OK!Found.");
		else
		    System.out.println("Found Nothing");
		
	}
}

